#include "../include/terminal.h"
#include "../include/kc.h"

extern tty ttyArray[MAX_TTY];
extern int curTTY;

void
switchTTY(int newTTY) {

	if (newTTY != curTTY) {
		curTTY = newTTY;
		ttyArray[curTTY].stdout.flush = 2;
		flush_screen(&(ttyArray[curTTY].stdout));
	}

	return;
}

void
initTTYs(void) {
	int i;

	for (i = 0; i < MAX_TTY; i++) {
		inibuff(&ttyArray[i].stdin);
		videoBuffInit(&ttyArray[i].stdout);
	}

	curTTY = 0;

	flush_screen(&(ttyArray[curTTY].stdout));
}
